<template>
	<!-- 产品参数 -->
	<view>
		<view class="specs" :class="specsInfo.show === true ? 'on' : ''">
			<view class="title">租用说明<text class="iconfont icon-guanbi5" @click="closeSpecs"></text></view>
			<view class="list">
				
				<view class="flow-title">
					<image v-if="appType == 1" src="../../../../static/images/icon/sanjiaoxing1.png" class="above-pic"></image>
					<image v-else-if="appType == 2" src="../../../../static/images/icon/sanjiaoxing2.png" class="above-pic"></image>
					<image v-else src="../../../../static/images/icon/sanjiaoxing.png" class="above-pic"></image>
					<view class="title-text">先用{{specsInfo.residue_stage}}期</view>
				</view>
				
				<view class="list-wrapper">
					<view class="item-wrapper" v-for="(item,index) in specsInfo.leased" :key="index">
						<view class="item acea-row">
							<view class="name">{{item.stage}}期</view>
							<view class="item-line"></view>
							<view class="val">¥{{item.stage_price}}</view>
						</view>
					</view>
				</view>
				
				<view class="flow-title">
					<image v-if="appType == 1" src="../../../../static/images/icon/sanjiaoxing1.png" class="above-pic"></image>
					<image v-else-if="appType == 2" src="../../../../static/images/icon/sanjiaoxing2.png" class="above-pic"></image>
					<image v-else src="../../../../static/images/icon/sanjiaoxing.png" class="above-pic"></image>
					<view class="title-text">租后可选</view>
				</view>
				
				<view class="info-list">
					<view class="info-item spu-desc-item">
						<view class="left app-b-color">
							<view>续租</view>
							<view class="to_left"></view>
						</view>
						<view class="right">
							<view class="info-title">月租金 ¥{{specsInfo.first_stage_price}}</view>
							<view class="info-content">租满后即可拥有该商品（续租期间可随时申请归还）</view>
						</view>
					</view>
					<view class="info-item spu-desc-item">
						<view class="left app-b-color">
							<text>买断</text>
							<view class="to_left"></view>
						</view>
						<view class="right">
							<view class="info-title">买断价 ¥{{specsInfo.buyout_price}}</view>
							<view class="info-content">只需一次性支付即可拥有此商品（租满后商品剩余的市场价值）</view>
						</view>
					</view>
					<view class="info-item spu-desc-item">
						<view class="left app-b-color">
							<text>归还</text>
							<view class="to_left"></view>
						</view>
						<view class="right">
							<view class="info-title">畅享新机</view>
							<view class="info-content">只需一次性支付即可拥有此商品（租满后商品剩余的市场价值）</view>
						</view>
					</view>
				</view>
				
			</view>
			<!-- <view class="bnt" @click="closeSpecs">完成</view> -->
			<slot name="bottom"></slot>
		</view>
		<view class="mask" @touchmove.prevent :hidden="specsInfo.show === false" @click="closeSpecs"></view>
	</view>
</template>

<script>
	let app = getApp()
	export default {
		props: {
			specsInfo: {
				type: Object,
				default: () => {}
			},
		},
		data() {
			return {
				appType: app.globalData.appType,
			};
		},
		mounted() {},
		methods: {
			closeSpecs(){
				this.$emit('myevent');
			}
		}
	}
</script>

<style scoped lang="scss">
	
	.to_left {
		position: absolute;
		right: -1rpx;
		top: 72rpx;
		width: 0;
		height: 0;            
		border-right: 16rpx solid #fff;            
		border-top: 16rpx solid transparent;            
		border-bottom: 16rpx solid transparent;   
	}             

	
	.flow-title {
		// display: flex;
		position: relative;
		margin-bottom: 24rpx;
		
		.above-pic {
			position: absolute;
			width: 88rpx !important;
			height: 33rpx;
		}
		
		.title-text {
			padding-left: 28rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: #1F1F1F;
			line-height: 33rpx;
			// background: linear-gradient(90deg, #E8F9F7 0%, rgba(57,204,194,0) 100%);
		}
	}
	
	.specs{
		position: fixed;
		bottom: 0;
		width: 100%;
		left: 0;
		background-color: #fff;
		z-index: 280;
		border-radius: 16rpx 16rpx 0 0;
		transform: translate3d(0, 100%, 0);
		transition: all .3s cubic-bezier(.25, .5, .5, .9);
		padding-bottom: 22rpx;
		padding-bottom: calc(22rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
		padding-bottom: calc(22rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
		.title{
			font-size: 32rpx;
			color: #282828;
			text-align: center;
			margin: 38rpx 0 36rpx 0;
			position: relative;
			.iconfont{
				position: absolute;
				right: 30rpx;
				top:0;
				font-size: 36rpx;
			}
		}
		.list{
			height: 850rpx;
			margin: 0 30rpx;
			overflow-x: hidden;
			overflow-y: auto;
		
			.list-wrapper {
				display: flex;
				flex-flow: row wrap;
				width: 100%;
			}
		
			.item-wrapper {
				flex: 0 0 50%;
				width: 50%;
				padding: 0 10rpx 20rpx 10rpx;
				box-sizing: border-box;
			}
			
			.item{
				padding: 24rpx 32rpx;
				border-radius: 46rpx;
				border: 1px solid #F5F5F5;
				.name{
					width: 70rpx;
					color: #999999;
					margin-right: 10rpx;
					color: #1F1F1F;
				}
				
				.item-line {
					width: 2rpx;
					height: 28rpx;
					margin-top: 4rpx;
					background: #EBEBEB;
				}
				
				.val{
					flex: 1;
					display: flex;
					align-items: center;
					justify-content: center;
				}
			}
			
			.info-list {
				.info-item {
					height: 180rpx;
					background: rgba(57,204,194,0.04);
					border-radius: 24rpx;
					border: 1px solid rgba(57,204,194,0.12);
					margin-bottom: 24rpx;
					display: flex;
					overflow: hidden;
					
					.left {
						position: relative;
						width: 168rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						background-color: #39CCC2;
						color: #fff;
					}
					
					.right {
						flex: 1;
						padding: 24rpx;
						display: flex;
						flex-direction: column;
						justify-content: center;
						.info-title {
							font-size: 28rpx;
							color: #1F1F1F;
						}
						.info-content {
							font-size: 24rpx;
							color: #999999;
							margin-top: 14rpx;
						}
					}
					
					
				}
			}
		}
		.bnt{
			width: 690rpx;
			height: 86rpx;
			text-align: center;
			line-height: 86rpx;
			border-radius: 43rpx;
			background-color: var(--view-theme);
			font-size: 30rpx;
			color: #fff;
			margin: 0 auto;
		}
	}
	.specs.on{
		transform: translate3d(0, 0, 0);
	}
</style>
